using System;
using System.Collections;
using System.Collections.Specialized;

namespace ctsu.Security
{	
	public class User
	{
		public string FirstName;
		public string LastName;
		public int ID;
		private bool _isAuthenticated = false;
		private ArrayList _roles;

		public User()
		{
			this.FirstName = "";
			this.LastName = "";
		}
		
		public User(int id, string fName, string lName)
		{
			this.ID = id;
            this.FirstName = fName;
			this.LastName = lName;
		}
		
		public bool IsInRole(int role)
		{
			return true;
		}

		public string Name
		{
			get{return FirstName + " " + LastName;}			
		}

		public bool IsAuthenticated
		{
			get{return _isAuthenticated;}
			set{_isAuthenticated = value;}
		}

		public ArrayList Roles
		{
			get{return _roles;}
			set{_roles = value;}			
		}

	}

	public class Role
	{
		private int _id;
		private Hierarchy _hierarchy;
		private int _item;
		private Permission _access;
		private string _name;
		private string _description;

		public Role(int id, Hierarchy hierarchy, Permission access, int item)
		{			
			this._id = id;
			this._hierarchy = hierarchy;
			this._access = access;
			this._item = item;						
		}

		public Role(int id, Hierarchy hierarchy, int item, string name, string description)
		{
			this._id = id;
			this._hierarchy = hierarchy;
			this._item = item;
			this._name = name;
			this._description = description;
		}	

		public int ID
		{
			get{return _id;}
			set{_id = value;}
		}

		public Hierarchy Hierarchy
		{
			get{return _hierarchy;}
			set{_hierarchy = value;}
		}

		public Permission Access
		{
			get{return _access;}
			set{_access = value;}
		}

		public int Item
		{
			get{return _item;}
			set{_item = value;}
		}

		public string Name
		{
			get{return _name;}
			set{_name = value;}
		}

		public string Description
		{
			get{return _description;}
			set{_description = value;}
		}

	}
}
